Ext.define('appmod.view.resources.RegisterMenuPanel', {
    extend: 'Ext.grid.Panel',
    alias: 'widget.regmenupanel', 
    width: 150,
    title: '菜单登记',

    initComponent: function() {
       var me = this;
        Ext.applyIf(me, {
            dockedItems: [
                {
                    xtype: 'toolbar',
                    dock: 'top',
                    items: [
                        {
                            xtype: 'button',
                            text: '登 记',
                            action:'register'
                        },
						/*
                        {
                            xtype: 'button',
                            text: '反登记',
                            action:'unregister'
                        },
                        */
                        '-',{
							fieldLabel:'菜单模块',
                            xtype:'combobox',
                            width:200,
							name:'moduleSel',
                            labelWidth: 60,
                            emptyText:'模块名',
							store : 'resources.RegisterModuleSelStore',
							queryMode : 'local',
							forceSelection : true,
							editable:false,
							displayField:'name',
							valueField:'value'
                        },{
                            width: 100,
                            emptyText : '菜单名称',
                            labelWidth: 80,
							name:'menuname',
                            xtype: 'textfield'
	                    },{
                            xtype: 'button',
                            text: '查找',
                            action:'menusimplesearch'
                        },'-'
						
                    ]
                }
            ],
            selModel: Ext.create('Ext.selection.CheckboxModel', {
                allowDeselect: true
            }),			
            columns:[{
                xtype: 'gridcolumn',
                text: '菜单',
                columns: [
                {
                    xtype: 'gridcolumn',
                    dataIndex: 'name',
                    width:150,
                    text: '菜单名称'
                },
                {
                    xtype: 'gridcolumn',
                    width:200,
                    dataIndex: 'code',
                    text: '菜单代码'
                }
                ]                
            },
            {
                xtype: 'gridcolumn',
                dataIndex: 'moduleName',
                text: '模块名称'
            },
            {
                xtype: 'numbercolumn',
                dataIndex: 'menuLevel',
				format:'0',
                text: '层级'
            },
            {
                xtype: 'booleancolumn',
                dataIndex: 'registered',
                text: '已登记',
				trueText:'是',
				falseText:'否'
            },
            {
                xtype: 'booleancolumn',
                dataIndex: 'disabled',
                text: '是否可用',
				trueText:'是',
				falseText:'否'
            }            
            ]


        });
        me.callParent(arguments);
		
    },
	
	
	refleshData:function(params) {
		var store = this.getStore();
		if (store) {
			
			// --- add new parameter ---
			var proxy = store.getProxy();
			if (params) {
				for (var i in params) {
					proxy.extraParams[i] = params[i];
				}
			}
			store.load();
		}
	}
	
	
});